package com.sz.biz.logistics.base.service.impl;

import com.sz.biz.logistics.base.entity.AirlineDetail;
import com.sz.biz.logistics.base.service.AirlineDetailService;
import com.sz.biz.logistics.base.dto.AirlineDetailDto;
import com.sz.common.base.service.AbstractService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * Function: AirlineDetailService <br>
 * Author: wentao.chang <br>
 * Date: 2017-08-21 15:47:00
 */
@Service("airlineDetailService")
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
public class AirlineDetailServiceImpl extends AbstractService implements AirlineDetailService {
    @Override
    public void save(List<AirlineDetailDto> flightDetailDto) {
        dao.batchInsert("AirlineDetailMapper.insert",flightDetailDto);
    }

    /**
     * 根据airlineId删除明细
     *
     * @param airlineId airlineId
     */
    @Override
    public void deleteByAirlineId(Integer airlineId) {
        dao.delete("AirlineDetailMapper.deleteByAirlineId",airlineId);
    }

    /**
     * 根据id查询航班信息
     *
     * @param airlineId airlineId
     * @return AirlineDto
     */
    @Override
    public List<AirlineDetail> findByAirlineId(Integer airlineId) {
        return dao.findForList("AirlineDetailMapper.selectByAirlineId",airlineId,AirlineDetail.class) ;
    }
}
